// import React, { useEffect } from 'react';
// import '../work.css';
// type Props = {
//   [x: string]: any;
// };
// export default function work1(props: Props) {
//   let data = props.history.location.state;
//   console.log(data);
//   return (
//     <div className="text_box_p">
//       <div className="text_box">
//         <div className="text_box_top">
//           <div className="text_box_title">{data.title}</div>
//           <div className="text_box_publish">发布时间：{data.publish}</div>
//         </div>
//         <div
//           className={data.reveive ? 'text_box_reveive' : 'text_box_no_reveive'}
//         >
//           <p>接收人： {data.reveive}</p>
//         </div>
//         <div className="text_box_content">
//           {data.content.map((item, index) => {
//             return <p key={index}>{item}</p>;
//           })}
//           {data.content_right.map((item, index) => {
//             return (
//               <p key={index} className="text_box_content_bottom">
//                 {item}
//               </p>
//             );
//           })}
//         </div>
//       </div>
//     </div>
//   );
// }

import React, { useEffect } from 'react';
import { Button } from 'antd';
import { useLocation } from 'react-router-dom';

import './index.less';

export default function work1(props: Props) {
  let notiItem = sessionStorage.getItem('noti-item');
  let location = useLocation();
  console.log(props.history.location.state, 'asdasdadasd');
  let { title, content, publish, log_file, _id, reveive } =
    props.history.location.state;
  //   location.state !== undefined ? props.history.location.state : JSON.parse(notiItem);
  useEffect(() => {
    return () => {
      // sessionStorage.setItem('noti-item', JSON.stringify(notiItem));
    };
  }, []);
  return (
    <div className="noti-item">
      <div className="noti-header">
        <button className="ant-btn-me">查看日志</button>
      </div>
      <div className="noti-main">
        <h2>{title}</h2>
        <span>发布时间：{publish}</span>
        {reveive !== undefined ? (
          <p className="reveive">接收人：{log_file.join(',')}</p>
        ) : (
          <></>
        )}

        <p className="noti-content">
          公司规章制度
          <br />
          {content.map((item: string, index: number) => (
            <p className="noti-content-item" key={index}>
              {item}
            </p>
          ))}
        </p>
        <div className="noti-table">
          <table border="1" cellPadding={0} cellSpacing={0}>
            <tr className="table-header">
              <td>文件名称</td>
              <td>文件大小</td>
              <td>上传时间</td>
              <td>上传人员</td>
              <td></td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td>相关说明.txt</td>
              <td>27B</td>
              <td>2023-02-08 18:23:58</td>
              <td>张燕</td>
              <td>
                <a>日志</a>
              </td>
              <td>
                <a>查看</a>
              </td>
              <td>
                <a>下载</a>
              </td>
            </tr>
          </table>
        </div>
      </div>
    </div>
  );
}
